import * as constants from '../Constants'
import { get, GET_THDEMAND_LIST, GET_THDEMAND_BY_ID } from '../../service/api'


export interface GetThdemandList {
  type: constants.GetThdemandList
  payload: Promise<any>
}

export interface GetThdemandList_PENDING {
  type: constants.GetThdemandList_PENDING
  payload: Promise<any>
}

export interface GetThdemandList_FULFILLED {
  type: constants.GetThdemandList_FULFILLED
  payload: any
}

export interface GetThdemandList_PAGE {
  type: constants.GetThdemandList_PAGE
  payload: any
}

export interface RECORD_THDEMAND {
  type: constants.RECORD_THDEMAND
  payload: Promise<any>
}
export interface RECORD_THDEMAND_FULFILLED {
  type: constants.RECORD_THDEMAND_FULFILLED
  payload: any
}

export type ThdemandAction = GetThdemandList | 
  GetThdemandList_FULFILLED | 
  GetThdemandList_PENDING | 
  GetThdemandList_PAGE |
  RECORD_THDEMAND |
  RECORD_THDEMAND_FULFILLED


export function getThdemandList(param: any): GetThdemandList {
  return {
    type: constants.GetThdemandList,
    payload: get(GET_THDEMAND_LIST, param)
  }
}
export function recordThdemand(param: any): RECORD_THDEMAND {
  return {
    type: constants.RECORD_THDEMAND,
    payload: get(GET_THDEMAND_BY_ID, param)
  }
}
export function page(page: any): GetThdemandList_PAGE {
  return {
    type: constants.GetThdemandList_PAGE,
    payload: page
  }
}